<template>
  <div id="asyncRoutesConfigEdit">
    <AsyncRoutesConfigForm @submitRoutesConfig="submitRoutesConfig" 
      :routesInfo="routesInfo"
      :showRule="showRule" />
  </div>
</template>

<script>
import AsyncRoutesConfigForm from './asyncRoutesConfigForm.vue';
import {
  findOne,updateMenu
} from '@/assets/request/api.js';
export default {
  name: "asyncRoutesConfigEdit",
  data() {
    return {
      routesInfo: {},
      showRule: {}
    };
  },
  methods: {
    submitRoutesConfig(routesInfo) {
      // 数据送给后端
      updateMenu(routesInfo).then(res => {
        this.$message({
          message: '更新成功',
          type: 'success'
        });
        this.$router.go(-1)
      }).catch(err => {
        this.$message({
          message: err.message,
          type: 'error'
        });
      })
    }
  },
  mounted() {
    findOne(this.$route.params.id).then(res => {
      this.routesInfo = res.data
      this.showRule = res.data
    }).catch(err => {
      this.$message({
        message: err.message,
        type: 'error'
      });
    })
  },
  components: { AsyncRoutesConfigForm }
}
</script>

<style scoped lang="scss">

 
</style>
